package com.preguicoso.server.servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gwt.user.client.Window;
import com.googlecode.objectify.util.DAOBase;
import com.preguicoso.server.dao.BannerDAO;
import com.preguicoso.server.dao.EstabelecimentoDAO;
import com.preguicoso.server.dao.ItemCardapioDAO;
import com.preguicoso.server.dao.PedidoDAO;
import com.preguicoso.server.entities.Estabelecimento;
import com.preguicoso.server.entities.ItemCardapio;
import com.preguicoso.server.entities.Pedido;
import com.preguicoso.shared.RegistroCategoriaEstabelecimento;
import com.preguicoso.shared.RegistroFormaPagamento;
import com.preguicoso.shared.RegistroStatusRestaurante;
import com.preguicoso.shared.entities.BannerBean;
import com.preguicoso.shared.entities.CategoriaBean;
import com.preguicoso.shared.entities.ItemCardapioBean;

public class ImprimirPedido extends HttpServlet{

		  /**
	 * 
	 */
	private static final long serialVersionUID = -4926295173748093247L;

		/**
	 * 
	 */

	@Override
	  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
	      throws ServletException, IOException {
			PrintWriter out = resp.getWriter();
	    
		try{
			PedidoDAO banco = new PedidoDAO();
			Pedido p = banco.retrieve(Long.parseLong(req.getParameter("id")));
			
			out.println("<html><head>");
			out.println("<script type='text/javascript' src='http://www.leandrogarcia.com/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>");
			out.println("<script type='text/javascript'>");
		    out.println(" $(window).load(function(){");
		    out.println(" 	  window.print()");
		    out.println(" 	});");
			out.println("</script>");
			out.println("</head>");
			out.println("Banner Criado Com sucesso:");
			out.println("<a href='#' onclick='window.print();'>Imprimir Página</a>" );
			out.println("</html>");
			
		
		}catch (Exception e) {
			 out.println(" Ocorreu algum erro:" +e.getMessage());
		}
		
		
	  }
}
